# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Patryk Kowalczyk < patryk at kowalczyk dot ws>

pkgname=spice
pkgver=0.15.0
pkgrel=1
pkgdesc="SPICE server"
arch=('x86_64')
url="https://www.spice-space.org"
license=('LGPL2.1')
depends=('pixman' 'opus' 'libjpeg-turbo' 'glib2' 'libsasl' 'lz4')
makedepends=('meson' 'spice-protocol' 'libcacard')
checkdepends=('gdk-pixbuf2' 'glib-networking')
provides=('libspice-server.so')
source=("https://www.spice-space.org/download/releases/spice-server/$pkgname-$pkgver.tar.bz2"{,.sig})
sha256sums=('b320cf8f4bd2852750acb703c15b72856027e5a8554f8217dfbb3cc09deba0f5'
            'SKIP')
validpgpkeys=('206D3B352F566F3B0E6572E997D9123DE37A484F') # Victor Toso <victortoso@redhat.com>

prepare() {
  sed -i "s/if not version_info.contains('git')/if version_info.length() >= 4/" $pkgname-$pkgver/server/meson.build
  # Consider removing the following sed once this issue is resolved:
  # https://gitlab.freedesktop.org/spice/spice/-/issues/62
  sed -i "/doxygen.sh/d" $pkgname-$pkgver/meson.build
}

build() {
  arch-meson "$pkgname-$pkgver" build -D gstreamer=no
  ninja -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  DESTDIR="$pkgdir" meson install -C build
}
